<div class="top">
    <div class="logo">数媒贴吧</div>
    <div class="login-info">
        <?php if (isset($_SESSION['user_id']) && isset($_SESSION['username'])):?>
            <span>欢迎您，<?php echo $_SESSION['username'];?></span>
            <a href="/index.php?c=post&a=add">发布帖子</a> |
            <a href="/index.php?c=user&a=logout">退出登录</a>
        <?php else:?>
            <a href="/index.php?c=user&a=login">登录</a> |
            <a href="/index.php?c=user&a=register">注册</a>
        <?php endif;?>
    </div>
</div>
<div class="nav">
    <ul>
        <li><a href="/">首页</a></li>
        <?php foreach ($navLists as $val):?>
            <li><a href="/index.php?cate_id=<?php echo $val['id'];?>"><?php echo $val['title'];?></a></li>
        <?php endforeach;?>
    </ul>
</div>